//
//  OrderDatailClass.m
//  YaoHeAPP
//
//  Created by mac on 15/12/23.
//  Copyright © 2015年 mac. All rights reserved.
//

#pragma mark-------------订单详情页

#import "OrderDatailClass.h"

#import "TongYong.h"

@implementation OrderDatailClass
-(id)initWithDid:(NSDictionary*)dic
{
    self=[super init];
    if (self) {
        self.priceUnit=dic[@"PRICE_UNIT"];
        self.purchaseID=dic[@"PURCHASE_ID"];
        self.materialName=dic[@"MATERIAL_NAME"];
        self.categoryName=dic[@"CATEGORY_NAME"];
        self.sellerUserID=dic[@"SELLER_USER_ID"];
        self.status=[dic[@"STATUS"] integerValue];
        self.varietyName=dic[@"VARIETY_NAME"];
        self.mobile=dic[@"MOBILE"];
        self.tolerance=dic[@"TOLERANCE"];
        self.surfaceName=dic[@"SURFACE_NAME"];
        self.specCode=dic[@"SPEC_CODE"];
        self.varietyID=dic[@"VARIETY_ID"];
        self.quotePrice=dic[@"QUOTE_PRICE"];
        self.sellerCompanyID=dic[@"SELLER_COMPANY_ID"];
        self.manufacturerName=dic[@"MANUFACTURER_NAME"];
        self.sellerCompanyName=dic[@"SELLER_COMPANY_NAME"];
        self.quoteRemark=dic[@"QUOTE_REMARK"];
        self.imgPathesAry=dic[@"IMG_PATHS"];
        self.purchaseRemark=dic[@"PURCHASE_REMARK"];
        self.orderID=dic[@"ORDER_ID"];
        self.sellerMobile=dic[@"SELLER_MOBILE"];
        self.orderCode=dic[@"ORDER_CODE"];
        self.weight=dic[@"WEIGHT"];
        self.userName=dic[@"USER_NAME"];
        self.creditScore=dic[@"CREDIT_SCORE"];
        self.supplyProvinceID=dic[@"SUPPLY_PROVINCE_ID"];
        self.isAddBlack=[dic[@"IS_ADD_BLACK"] integerValue];
        self.quantity=dic[@"QUANTITY"];
        self.logoImgPath=dic[@"LOGO_IMG_PATH"];
        self.isNeedTesting=dic[@"IS_NEED_TESTING"];
        self.isNeedInvoice=dic[@"IS_NEED_INVOICE"];
        self.createTime=dic[@"CREATE_TIME"];
        self.supplyCityID=dic[@"SUPPLY_CITY_ID"];
        
        if ([TongYong isBlankObjectAndStr:dic[@"REPORT_STATUS"]]) {
            self.reportStatus=5;
        }else{
            self.reportStatus=[dic[@"REPORT_STATUS"] integerValue];
        }
        self.sellerUserName=dic[@"SELLER_USER_NAME"];
        self.orderTime=dic[@"ORDER_TIME"];
        
        if ([[dic allKeys] containsObject:@"PRODUCT_SCORE"]) {
            self.productScore=dic[@"PRODUCT_SCORE"];
        }
        if ([[dic allKeys] containsObject:@"SERVICE_SCORE"]) {
            self.serviceScore=dic[@"SERVICE_SCORE"];
        }
        if ([[dic allKeys]containsObject:@"LOGISTICS_SCORE"]) {
            self.logisticsScore=dic[@"LOGISTICS_SCORE"];
        }
        if ([[dic allKeys]containsObject:@"EVALUATION_REMARK"]) {
            self.evaluationRemark=dic[@"EVALUATION_REMARK"];
        }
        self.nationalStandard=[self withDic:dic Key:@"NATIONAL_STANDARD"];
        self.tradeMark=[self withDic:dic Key:@"TRADE_MARK"];
    }
    return self;
}
-(NSString*)withDic:(NSDictionary*)dic Key:(NSString*)key
{
    NSString*string;
    if ([[dic allKeys]containsObject:key]) {
        string=dic[key];
    }
    else{
       string=@"";
    }
    return string;
}

@end
